package com.company.jee.common.exception;

/**
 * Clase encargada de representar una exepcion basica de la aplicacion
 * 
 * @author Luis Felipe Sosa
 */
public class SystemException extends Exception {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Exception parentException;
	private String methodName = "";
	private String className = "";
	private String jndiHomeName = "";

	public SystemException(Exception parentException, String className,
			String methodName) {
		this.parentException = parentException;
		this.methodName = methodName;
		this.className = className;
	}

	public SystemException(Exception parentException, String className,
			String methodName, String jndiHomeName) {
		this.parentException = parentException;
		this.methodName = methodName;
		this.className = className;
		this.jndiHomeName = jndiHomeName;
	}

	/**
	 * Retorna un mensaje a partir de los datos especificados
	 */
	public String getMessage() {
		StringBuffer buf = new StringBuffer();
		buf.append(getParentException().getMessage()+" ");
		buf.append(getClassName()+" ");
		buf.append(getMethodName()+" ");
		buf.append(getJndiHomeName()+" ");
		return buf.toString();
	}

	public Exception getParentException() {
		return parentException;
	}

	public String getClassName() {
		return className;
	}

	public String getMethodName() {
		return methodName;
	}

	public String getJndiHomeName() {
		return jndiHomeName;
	}
}
